<template>
    <div class="box">
        <header class="header">
            我的
        </header>
        <div class="content">
            用户名： {{ username }}
            <div>
                <van-button type="default" @click="loginout">退出登录</van-button>
            </div>
        </div>
    </div>
</template>
<script setup>
import { useRouter } from 'vue-router'
const router = useRouter()
const username = localStorage.getItem('username')
const loginout = () => {
    // 清除token和用户名
    localStorage.removeItem('token')
    localStorage.removeItem('username')
    // 跳转登录页面
    router.push('/login')
}
</script>